<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app">
        点击次数：{{counter}}
        <button @click="handleAnd( )">+1</button>
        <button @click='handleAnd(10)'>+10</button>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script>
        new Vue({
            el:'#app',
            data:{
                counter: 0
            },
            methods:{
                handleAnd:function(count){
                    count = count || 1;
                    //this指向当前Vue实例app
                    this.counter += count;
                }
            }
        })
    </script>
</body>
</html>